import React from 'react';
import {
    ActivityIndicator,
    StatusBar,
    View, StyleSheet, Text
} from 'react-native';
import { Storage } from '../utils';
export default class AuthLoadingScreen extends React.Component {
    constructor(props) {
        super(props);
        this._bootstrapAsync();
    }

    // Fetch the token from storage then navigate to our appropriate place
    _bootstrapAsync = () => {
        const userToken = Storage.get('userInfo').then((value) => {
            this.props.navigation.navigate(value ? 'Main' : 'Login');
        });
    };

    // Render any loading content that you like here
    render() {
        return (
            <View style={styles.container}>
                <ActivityIndicator />
                <StatusBar barStyle="default" backgroundColor="#fff" />
                <Text>验证登录中</Text>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
    },
})
